#!/bin/bash

download_url='http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz'
download_path='/dl/yasm'
install_path='/lib/yasm'
tarFile='yasm-1.3.0.tar.gz'
sourceFile='yasm-1.3.0'

make_dir() {
  mkdir -p $download_path
  mkdir -p $install_path
}

download() {
  cd $download_path || exit
  wget $download_url
  if [ -e $tarFile ]; then
    tar -zxvf $tarFile
    echo '下载并解压完毕'
  else
    echo '下载压缩包失败'
    exit
  fi
}

compile() {
  cd $sourceFile || exit
  ./configure
  make
#  不要指定安装路径！不然FFmpeg找不到
  make install
}

make_dir
download
compile